namespace Roids.SL.Framework
{
    using Microsoft.Xna.Framework;
    using Microsoft.Xna.Framework.Graphics;

    public abstract class SceneItem : ISceneComponent
    {
        protected SceneItem(Game game)
        {
            Game = game;
            Acceleration = new Vector2();
            Position = new Vector2();
            Velocity = new Vector2();
        }

        public Game Game { get; set; }

        public float Radius { get; set; }

        public Vector2 Acceleration { get; set; }
        public Vector2 Position { get; set; }
        public Vector2 Velocity { get; set; }
        public float Rotation { get; set; }

        public bool IsPaused { get; set; }

        public bool ReadyToRemove { get; set; }

        public virtual void LoadContent()
        {
        }

        public virtual void Update(GameTime gameTime)
        {
            var elapsedTime = gameTime.ElapsedGameTime;

            if (!IsPaused)
            {
                //Do the basic acceleration/velocity/position updates
                Velocity += Vector2.Multiply(Acceleration, (float) elapsedTime.TotalSeconds);
                Position += Vector2.Multiply(Velocity, (float) elapsedTime.TotalSeconds);
            }
        }

        public virtual void Draw(GameTime gameTime, SpriteBatch batch)
        {
        }
    }
}